<template>
  <div class="container contract-review mb70">
    <p class="bread">
      <a :href="href" class="font-s-18">{{orderName}}</a> >
      <a href="javascript:void(0);" class="font-s-16">详情</a>
    </p>
    <div class="bg-c-fff box-border">
      <h3 class="tm-title">交易监控订单详情</h3>
      <step :stepData="stepData" :stepNum="stepNum" @stepRouter="stepRouter"></step>
    </div>
    <div class="content bg-c-fff tc">
      <img src="../assets/sh.png" alt="" class="db auto">
      <p class="tc">监控师正在绘制交易监控流程图，请耐心等待。
        <br>流程图绘制成功后，自动进入交易监控阶段</p>
    </div>
  </div>
</template>
<script type="text/javascript">
import Step from '../components/Step'
export default {
  components: {
    Step
  },
  data() {
    return {
      stepNum: 2,
      stepData: [{
        name: '查看资质审查报告'
      }, {
        name: '查看审查合同'
      }, {
        name: '监控师绘制流程图'
      }, {
        name: '监控员交易监控'
      }],
      orderName: '',
      href: ''
    }
  },
  mounted() {
    if (this.$route.query.type === 'business') {
      this.orderName = '业务管理部-交易监控订单管理'
      this.href = '#/index/transaction-order-manage'
    } else if (this.$route.query.type === 'chief') {
      this.orderName = '首席监控师-交易监控订单管理'
      this.href = '#/index/cm-transaction-list'
    } else if (this.$route.query.type === 'businessNotice') {
      this.orderName = '业务管理部-交易监控通知'
      this.href = '#/index/transaction-notice'
    }
    this.getData()
  },
  methods: {
    getData() {
      this.$http.post('/transactionMonitorSer/sys/read/detail', {
        id: this.$route.query.id
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.status = data.data.data.status
        } else {
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
        this.$toasted.show('网络出错')
      })
    },
    stepRouter(i, name) {
      if (i === 0 && this.status >= 2) {
        this.$router.push('/cm-transaction-aptitude?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
      }
      if (i === 1 && this.status >= 3) {
        this.$router.push('/cm-transaction-contract?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
      }
      if (i === 2 && this.status >= 4) {
        this.$router.push('/cm-transaction-drawing?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
      }
      if (i === 3 && this.status >= 5) {
        this.$router.push('/cm-transaction-flow?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
      }
    }
  }
}

</script>
<style type="text/css" scoped>
.content {
  padding: 50px 0;
  margin-top: 20px;
}

.content p {
  margin-top: 30px;
  color: #989696;
}

</style>
